﻿/*
 * K.I.S.S. Konsole for High Performance Software Defined Radio
 *
 * 
 * Copyright (C) 2009 Phil Harman, VK6APH
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 * 
 *  V1.0.0 
 */

/*
 * Change log 
 * 
 * 20 May 2009 - Added Sampling Rate control
 * 21 May 2009 - Added Noise Blanker Thresholds
 * 22 May 2009 - Added Bandscope Controls
 * 23 May 2009 - Added IQ Gain control
 * 
 * 
 * 
 * TODO: Remove focus from control once used
 */


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;   // use View > Output to see debug messages


namespace KISS_Konsole
{
    public partial class SetupForm : Form
    {
        Form1 MainForm;             // reference to Form1

        public SetupForm(Form1 Parent) // get reference from Form1 so we know where variables are 
        {
            InitializeComponent();

            MainForm = Parent;

            suspendUpdate = true;

            // display Average  state, on/off
            this.Average.Checked = MainForm.rcvr.PowerSpectrumAveragingOn;  
            // display Smoothing Factor, convert from float 0.01 - 0.99 to integer 1 - 99
            float smooth = MainForm.rcvr.PowerSpectrumSmoothingFactor * 100f;
            this.Smoothing.Value = (int)smooth;
            if (Average.Checked)   // only enable Smoothing control if Average checked
                Smoothing.Enabled = true;
            else Smoothing.Enabled = false;
            // display Noise Blanker Thresholds, convert 0.1 - 20 to 1 - 200 to display on control
            float temp1 = MainForm.rcvr.BlockNBThreshold * 10f;
            float temp2 = MainForm.rcvr.AveNBThreshold * 10f;
            this.NB1Threshold.Value = (int)temp1;       // set NB1 Threshold, this forces control to run 
            this.NB2Threshold.Value = (int)temp2;       // set NB2 Threshold, this forces control to run
            // display Bandscope update rate 
            this.UpdateRate.Value = MainForm.Rate;
            // display IQScale setting 
            this.IQScale.Value = MainForm.IQScale;
            // set I display on/off
            Ion.Checked = MainForm.ShowI;
            // set Q display on/off
            Qon.Checked = MainForm.ShowQ;
            // set Waterfall AGC on/off
            WaterfallAGC.Checked = MainForm.WaterfallAGC;
            // set Penelope present
            chkPenelope.Checked = MainForm.PenneyPresent;
            // set Mic Gain selected
            chkMicGain.Checked = MainForm.MicGain20dB;
            // set Atlas10MHz selected
            Atlas10MHz.Checked = MainForm.Atlas10MHz;
            // set Penelope10MHz selected
            Penelope10MHz.Checked = MainForm.Penelope10MHz;
            // set Mercury10MHz slected
            Mercury10MHz.Checked = MainForm.Mercury10MHz;
            // set Exchalibur selected
            chkExcalibur.Checked = MainForm.Excalibur;
            // set High filter value
            TxFilterHigh.Value = (int) MainForm.TxFilterHigh;
            // set Low filter value
            TxFilterLow.Value = (int)MainForm.TxFilterLow;

            // set the gains per band
            Gain160m.Value = MainForm.Gain160m;
            Gain80m.Value  = MainForm.Gain80m;
            Gain60m.Value  = MainForm.Gain60m;
            Gain40m.Value  = MainForm.Gain40m;
            Gain30m.Value  = MainForm.Gain30m;
            Gain20m.Value  = MainForm.Gain20m;
            Gain17m.Value  = MainForm.Gain17m;
            Gain15m.Value = MainForm.Gain15m;
            Gain12m.Value  = MainForm.Gain12m;
            Gain10m.Value  = MainForm.Gain10m;
            Gain6m.Value   = MainForm.Gain6m;

            // set Full Duplex state
            chkMuteRxOnPTT.Checked = !MainForm.Duplex;
            chkOnlyTxOnPTT.Checked = MainForm.OnlyTxOnPTT;

            // set Tune power percentage
            TuneLevel.Value = MainForm.TuneLevel;

            // display callsign
            textBoxCallSign.Text = MainForm.Your_call;

            // ANF filter
            numericUpDownANFAdaptiveFilterSize.Value = MainForm.ANFAdaptiveFilterSize;
            numericUpDownANFLeakage.Value = (decimal)MainForm.ANFLeakage;
            numericUpDownANFDelay.Value = MainForm.ANFDelay;
            numericUpDownANFAdaptationRate.Value = (decimal)MainForm.ANFAdaptationRate;

            // NR filter
            numericUpDownNRAdaptiveFilterSize.Value = MainForm.NRAdaptiveFilterSize;
            numericUpDownNRLeakage.Value = (decimal)MainForm.NRLeakage;
            numericUpDownNRDelay.Value = MainForm.NRDelay;
            numericUpDownNRAdaptationRate.Value = (decimal)MainForm.NRAdaptationRate;

            // Bandscope settings
            GridMax.Value = MainForm.GridMax;
            GridMin.Value = MainForm.GridMin;
            GridStep.Value = MainForm.GridStep;

            // AGC settings
            numericUpDownAGCHangThreshold.Value = Convert.ToDecimal(MainForm.AGCHangThreshold);
            numericUpDownAGCHangTime.Value = Convert.ToDecimal(MainForm.AGCHangTime);
            numericUpDownAGCHangDecayTime.Value = Convert.ToDecimal(MainForm.AGCMaximumGainDB);
            numericUpDownAGCSlope.Value = Convert.ToDecimal(MainForm.AGCSlope);
            comboBoxAGCMethod.SelectedIndex = Convert.ToInt32(MainForm.AgcMethod);
            numericUpDownAGCAttackTime.Value = Convert.ToDecimal(MainForm.AGCAttackTime);
            numericUpDownAGCFastAttackTime.Value = Convert.ToDecimal(MainForm.AGCFastAttackTime);
            numericUpDownAGCFastDecayTime.Value = Convert.ToDecimal(MainForm.AGCFastDecayTime);

            WaterFall_High.Value = Convert.ToDecimal(MainForm.WaterfallHighThreshold);
            WaterFall_Low.Value = Convert.ToDecimal(MainForm.WaterfallLowThreshold);

            //Penny Open Collector settings
            chkExtCtrlEnable.Checked = MainForm.PennyOC;

            // Penny Open Collector receive settings
            checkBoxesPenOC160mRX.Value = MainForm.Penny160mRxOC;
            checkBoxesPenOC80mRX.Value = MainForm.Penny80mRxOC;
            checkBoxesPenOC60mRX.Value = MainForm.Penny60mRxOC;
            checkBoxesPenOC40mRX.Value = MainForm.Penny40mRxOC;
            checkBoxesPenOC30mRX.Value = MainForm.Penny30mRxOC;
            checkBoxesPenOC20mRX.Value = MainForm.Penny20mRxOC;
            checkBoxesPenOC17mRX.Value = MainForm.Penny17mRxOC;
            checkBoxesPenOC15mRX.Value = MainForm.Penny15mRxOC;
            checkBoxesPenOC12mRX.Value = MainForm.Penny12mRxOC;
            checkBoxesPenOC10mRX.Value = MainForm.Penny10mRxOC;
            checkBoxesPenOC6mRX.Value = MainForm.Penny6mRxOC;

            // Penny Open Collector transmit settings
            checkBoxesPenOC160mTX.Value = MainForm.Penny160mTxOC;
            checkBoxesPenOC80mTX.Value = MainForm.Penny80mTxOC;
            checkBoxesPenOC60mTX.Value = MainForm.Penny60mTxOC;
            checkBoxesPenOC40mTX.Value = MainForm.Penny40mTxOC;
            checkBoxesPenOC30mTX.Value = MainForm.Penny30mTxOC;
            checkBoxesPenOC20mTX.Value = MainForm.Penny20mTxOC;
            checkBoxesPenOC17mTX.Value = MainForm.Penny17mTxOC;
            checkBoxesPenOC15mTX.Value = MainForm.Penny15mTxOC;
            checkBoxesPenOC12mTX.Value = MainForm.Penny12mTxOC;
            checkBoxesPenOC10mTX.Value = MainForm.Penny10mTxOC;
            checkBoxesPenOC6mTX.Value = MainForm.Penny6mTxOC;

            suspendUpdate = false;
        }

        bool suspendUpdate = false;

        // convert selected SampleRate.Text to an integer and send to the MainForm & DSP 
        public void SampleRate_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (suspendUpdate)
            {
                return;
            }

            MainForm.SampleRate = Int32.Parse(this.SampleRate.Text); // 48000,96000 or 192000
            MainForm.state.DSPSampleRate = MainForm.SampleRate;      // change the DSP sample rate
            MainForm.AdjustFilterByMode();                           // set the bandwidth since dependant on sample rate
       }

        // Threshold value control is from 1 to 200, convert to float as 0.1 to 20
        private void NB1Threshold_ValueChanged(object sender, EventArgs e)
        {
            if (suspendUpdate)
            {
                return;
            }

            MainForm.rcvr.BlockNBThreshold = (float)((float)NB1Threshold.Value / 10f);
        }

        // Threshold value control is from 1 to 200, convert to float as 0.1 to 20
        private void NB2Threshold_ValueChanged(object sender, EventArgs e)
        {
            if (suspendUpdate)
            {
                return;
            }

            MainForm.rcvr.AveNBThreshold = (float)((float)NB2Threshold.Value / 10f);
        }

        // Turn Bandscope Averaging on/off
        private void Average_CheckedChanged(object sender, EventArgs e)
        {
            if (suspendUpdate)
            {
                return;
            }

            MainForm.rcvr.PowerSpectrumAveragingOn = Average.Checked;
            if (Average.Checked)            // only display Smoothing control if Average is on 
                Smoothing.Enabled = true;
            else Smoothing.Enabled = false; 
        }

        // Set Bandscope Smoothing Factor as float 0.1 to 20
        private void Smoothing_ValueChanged(object sender, EventArgs e)
        {
            if (suspendUpdate)
            {
                return;
            }

            MainForm.rcvr.PowerSpectrumSmoothingFactor = (float)((float)Smoothing.Value / 100f); 
        }

        // Set Bandscope update rate 
        public void UpdateRate_ValueChanged(object sender, EventArgs e)
        {
            if (suspendUpdate)
            {
                return;
            }

            MainForm.Rate = (int)UpdateRate.Value;
        }
        
        // Display I channel when checked
        public void Ion_CheckedChanged(object sender, EventArgs e)
        {
            if (suspendUpdate)
            {
                return;
            }

            MainForm.ShowI = Ion.Checked;
        }

        // Display Q channel when checked
        private void Qon_CheckedChanged(object sender, EventArgs e)
        {
            if (suspendUpdate)
            {
                return;
            }

            MainForm.ShowQ = Qon.Checked;
        }
        
        // Adjust gain of I&Q display 
        public void IQScale_ValueChanged(object sender, EventArgs e)
        {
            if (suspendUpdate)
            {
                return;
            }

            MainForm.IQScale = (int)this.IQScale.Value;
        }

        private void textBoxCallSign_TextChanged(object sender, EventArgs e)
        {
            if (suspendUpdate)
            {
                return;
            }

            MainForm.Your_call = textBoxCallSign.Text;
            MainForm.UpdateFormTitle();
            MainForm.output_signcall = textBoxCallSign.Text;
        }

        public void GridMax_ValueChanged(object sender, EventArgs e)
        {
            if (suspendUpdate)
            {
                return;
            }

            MainForm.GridMax = (int)this.GridMax.Value;            
        }

        public void GridMin_ValueChanged(object sender, EventArgs e)
        {
            if (suspendUpdate)
            {
                return;
            }

            MainForm.GridMin = (int)this.GridMin.Value;
        }

        public void GridStep_ValueChanged(object sender, EventArgs e)
        {
            if (suspendUpdate)
            {
                return;
            }

            MainForm.GridStep = (int)this.GridStep.Value;
        }

        private void numericUpDownANFAdaptiveFilterSize_ValueChanged(object sender, EventArgs e)
        {
            if (suspendUpdate)
            {
                return;
            }

            MainForm.ANFAdaptiveFilterSize = (int)numericUpDownANFAdaptiveFilterSize.Value;
        }

        private void numericUpDownANFDelay_ValueChanged(object sender, EventArgs e)
        {
            if (suspendUpdate)
            {
                return;
            }

            MainForm.ANFDelay = (int)numericUpDownANFDelay.Value;
        }

        private void numericUpDownANFAdaptationRate_ValueChanged(object sender, EventArgs e)
        {
            if (suspendUpdate)
            {
                return;
            }

            MainForm.ANFAdaptationRate = (float)numericUpDownANFAdaptationRate.Value;
        }

        private void numericUpDownANFLeakage_ValueChanged(object sender, EventArgs e)
        {
            if (suspendUpdate)
            {
                return;
            }

            MainForm.ANFLeakage = (float)numericUpDownANFLeakage.Value;
        }

        private void numericUpDownNRAdaptiveFilterSize_ValueChanged(object sender, EventArgs e)
        {
            if (suspendUpdate)
            {
                return;
            }

            MainForm.NRAdaptiveFilterSize = (int)numericUpDownNRAdaptiveFilterSize.Value;
        }

        private void numericUpDownNRDelay_ValueChanged(object sender, EventArgs e)
        {
            if (suspendUpdate)
            {
                return;
            }

            MainForm.NRDelay = (int)numericUpDownNRDelay.Value;
        }

        private void numericUpDownNRAdaptationRate_ValueChanged(object sender, EventArgs e)
        {
            if (suspendUpdate)
            {
                return;
            }

            MainForm.NRAdaptationRate = (float)numericUpDownNRAdaptationRate.Value;
        }

        private void numericUpDownNRLeakage_ValueChanged(object sender, EventArgs e)
        {
            if (suspendUpdate)
            {
                return;
            }

            MainForm.NRLeakage = (float)numericUpDownNRLeakage.Value;
        }
        private void comboBoxAGCMethod_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (suspendUpdate)
            {
                return;
            }

            if (comboBoxAGCMethod.SelectedIndex != -1)
            {
                MainForm.AgcMethod = (SharpDSP2._1.AGCMethod)comboBoxAGCMethod.SelectedIndex;
            }
        }

        private void numericUpDownAGCMaxGain_ValueChanged(object sender, EventArgs e)
        {
            if (suspendUpdate)
            {
                return;
            }

            MainForm.AGCMaximumGainDB = (float)numericUpDownAGCHangDecayTime.Value;
        }

        private void numericUpDownAGCHangTime_ValueChanged(object sender, EventArgs e)
        {
            if (suspendUpdate)
            {
                return;
            }

            MainForm.AGCHangTime = (float)numericUpDownAGCHangTime.Value;
        }

        private void numericUpDownAGCHangThreshold_ValueChanged(object sender, EventArgs e)
        {
            if (suspendUpdate)
            {
                return;
            }

            MainForm.AGCHangThreshold = (float)numericUpDownAGCHangThreshold.Value;
        }

        private void numericUpDownAGCSlope_ValueChanged(object sender, EventArgs e)
        {
            if (suspendUpdate)
            {
                return;
            }

            MainForm.AGCSlope = (float)numericUpDownAGCSlope.Value;
        }

        private void numericUpDownAGCAttackTime_ValueChanged(object sender, EventArgs e)
        {
            if (suspendUpdate)
            {
                return;
            }

            MainForm.AGCAttackTime = (float)numericUpDownAGCAttackTime.Value;
        }

        private void numericUpDownFastAttackTime_ValueChanged(object sender, EventArgs e)
        {
            if (suspendUpdate)
            {
                return;
            }

            MainForm.AGCFastAttackTime = (float)numericUpDownAGCFastAttackTime.Value;
        }

        private void numericUpDownFastDecayTime_ValueChanged(object sender, EventArgs e)
        {
            if (suspendUpdate)
            {
                return;
            }

            MainForm.AGCFastDecayTime = (float)numericUpDownAGCFastDecayTime.Value;
        }

        private void Setupform_FormClosed(object sender, FormClosedEventArgs e)
        {
        }

        public void WaterFall_Low_ValueChanged(object sender, EventArgs e)
        {
            if (suspendUpdate)
            {
                return;
            }

            MainForm.WaterfallLowThreshold = (int)WaterFall_Low.Value;
        }

        private void WaterFall_High_ValueChanged(object sender, EventArgs e)
        {
            if (suspendUpdate)
            {
                return;
            }

            MainForm.WaterfallHighThreshold = (int)WaterFall_High.Value;
        }

        // turn on Waterfall AGC when selected
        public void WaterfallAGC_CheckedChanged(object sender, EventArgs e)
        {
            if (suspendUpdate)
            {
                return;
            }

            MainForm.WaterfallAGC = WaterfallAGC.Checked;
            if (WaterfallAGC.Checked)            // only display control if AGC is off 
                WaterFall_Low.Enabled = false;
            else WaterFall_Low.Enabled = true; 
        }

        // enable Penelope if selected
        public void chkPenelope_CheckedChanged(object sender, EventArgs e)
        {
            if (suspendUpdate)
            {
                return;
            }

            MainForm.PenneyPresent = chkPenelope.Checked;
            if (chkPenelope.Checked)
                chkMicGain.Enabled = true;
            else chkMicGain.Enabled = false;
        }

        public void chkMicGain_CheckedChanged(object sender, EventArgs e)
        {
            if (suspendUpdate)
            {
                return;
            }

            MainForm.MicGain20dB = chkMicGain.Checked;
        }

        public void Penelope10MHz_CheckedChanged(object sender, EventArgs e)
        {
            if (suspendUpdate)
            {
                return;
            }

            MainForm.Penelope10MHz = Penelope10MHz.Checked;
            //if (Penelope10MHz.Checked)
            //{
            //    Atlas10MHz.Checked = false;
            //    Mercury10MHz.Checked = false;
            //}
        }

        public void Atlas10MHz_CheckedChanged(object sender, EventArgs e)
        {
            if (suspendUpdate)
            {
                return;
            }

            MainForm.Atlas10MHz = Atlas10MHz.Checked;
            //if (Atlas10MHz.Checked)
            //{
            //    Penelope10MHz.Checked = false;
            //    Mercury10MHz.Checked = false;
            //}
        }

        public void Mercury10MHz_CheckedChanged(object sender, EventArgs e)
        {
            if (suspendUpdate)
            {
                return;
            }

            MainForm.Mercury10MHz = Mercury10MHz.Checked;
            //if (Mercury10MHz.Checked)
            //{
            //    Penelope10MHz.Checked = false;
            //    Atlas10MHz.Checked = false;
            //}
        }

        private void chkExcalibur_CheckedChanged(object sender, EventArgs e)
        {
            if (suspendUpdate)
            {
                return;
            }

            MainForm.Atlas10MHz = chkExcalibur.Checked;
            if (chkExcalibur.Checked)
            {
                Atlas10MHz.Enabled = false;
                Penelope10MHz.Enabled = false;
                Mercury10MHz.Enabled = false;
            }
            else
            {
                Atlas10MHz.Enabled = true;
                Penelope10MHz.Enabled = true;
                Mercury10MHz.Enabled = true;
            }
        }

        public void TxFilterHigh_ValueChanged(object sender, EventArgs e)
        {
            if (suspendUpdate)
            {
                return;
            }

            MainForm.TxFilterHigh = (float)TxFilterHigh.Value;
            MainForm.AdjustFilterByMode();  // force read of new value
        }

        private void TxFilterLow_ValueChanged(object sender, EventArgs e)
        {
            if (suspendUpdate)
            {
                return;
            }

            MainForm.TxFilterLow = (float)TxFilterLow.Value;
            MainForm.AdjustFilterByMode(); // force read of new value 
        }

        private void Gain160m_ValueChanged(object sender, EventArgs e)
        {
            if (suspendUpdate)
            {
                return;
            }

            MainForm.Gain160m = (int)Gain160m.Value;
            MainForm.UpdateBandGain();
        }

        private void Gain80m_ValueChanged(object sender, EventArgs e)
        {
            if (suspendUpdate)
            {
                return;
            }

            MainForm.Gain80m = (int)Gain80m.Value;
            MainForm.UpdateBandGain();
        }

        private void Gain60m_ValueChanged(object sender, EventArgs e)
        {
            if (suspendUpdate)
            {
                return;
            }

            MainForm.Gain60m = (int)Gain60m.Value;
            MainForm.UpdateBandGain();
        }

        private void Gain40m_ValueChanged(object sender, EventArgs e)
        {
            if (suspendUpdate)
            {
                return;
            }

            MainForm.Gain40m = (int)Gain40m.Value;
            MainForm.UpdateBandGain();
        }

        private void Gain30m_ValueChanged(object sender, EventArgs e)
        {
            if (suspendUpdate)
            {
                return;
            }

            MainForm.Gain30m = (int)Gain30m.Value;
            MainForm.UpdateBandGain();
        }

        private void Gain20m_ValueChanged(object sender, EventArgs e)
        {
            if (suspendUpdate)
            {
                return;
            }

            MainForm.Gain20m = (int)Gain20m.Value;
            MainForm.UpdateBandGain();
        }

        private void Gain17m_ValueChanged(object sender, EventArgs e)
        {
            if (suspendUpdate)
            {
                return;
            }

            MainForm.Gain17m = (int)Gain17m.Value;
            MainForm.UpdateBandGain();
        }

        private void Gain15m_ValueChanged(object sender, EventArgs e)
        {
            if (suspendUpdate)
            {
                return;
            }

            MainForm.Gain15m = (int)Gain15m.Value;
            MainForm.UpdateBandGain();
        }

        private void Gain12m_ValueChanged(object sender, EventArgs e)
        {
            if (suspendUpdate)
            {
                return;
            }

            MainForm.Gain12m = (int)Gain12m.Value;
            MainForm.UpdateBandGain();
        }

        private void Gain10m_ValueChanged(object sender, EventArgs e)
        {
            if (suspendUpdate)
            {
                return;
            }

            MainForm.Gain10m = (int)Gain10m.Value;
            MainForm.UpdateBandGain();
        }

        private void Gain6m_ValueChanged(object sender, EventArgs e)
        {
            if (suspendUpdate)
            {
                return;
            }

            MainForm.Gain6m = (int)Gain6m.Value;
            MainForm.UpdateBandGain();
        }

        private void chkMuteRxOnPTT_CheckedChanged(object sender, EventArgs e)
        {
            if (suspendUpdate)
            {
                return;
            }

            MainForm.Duplex = !chkMuteRxOnPTT.Checked;
            MainForm.setVolumeSquelched(); // force update of receiver audio mute
        }

        private void TuneLevel_ValueChanged(object sender, EventArgs e)
        {
            if (suspendUpdate)
            {
                return;
            }

            MainForm.TuneLevel = (int)TuneLevel.Value;
        }

        private void Set_CWPitch_ValueChanged(object sender, EventArgs e)
        {
            MainForm.CWPitch = (int)Set_CWPitch.Value;      // if user types in a number, get the new value 
            MainForm.AdjustFilterByMode();                  // force read of new value
        }

        // select all Penny Open Collector controls
        private void chkExtCtrlEnable_CheckedChanged(object sender, EventArgs e)
        {
            if (suspendUpdate)
            {
                return;
            }
            
            if (chkExtCtrlEnable.Checked)
            {
                PennyOC.Enabled = true;
            }
            else
            {
                PennyOC.Enabled = false;
            }
            MainForm.PennyOC = chkExtCtrlEnable.Checked;
        }


        // Penny Receive Open Collector settings

        private void checkBoxesPenOC6mRX_CheckedChanged(object sender, EventArgs e)
        {
            if (suspendUpdate)
            {
                return;
            }

            MainForm.Penny6mRxOC = checkBoxesPenOC6mRX.Value;
        }

        private void checkBoxesPenOC10mRX_CheckedChanged(object sender, EventArgs e)
        {
            if (suspendUpdate)
            {
                return;
            }

            MainForm.Penny10mRxOC = checkBoxesPenOC10mRX.Value;
        }

        private void checkBoxesPenOC12mRX_CheckedChanged(object sender, EventArgs e)
        {
            if (suspendUpdate)
            {
                return;
            }

            MainForm.Penny12mRxOC = checkBoxesPenOC12mRX.Value;
        }

        private void checkBoxesPenOC15mRX_CheckedChanged(object sender, EventArgs e)
        {
            if (suspendUpdate)
            {
                return;
            }

            MainForm.Penny15mRxOC = checkBoxesPenOC15mRX.Value;
        }

        private void checkBoxesPenOC17mRX_CheckedChanged(object sender, EventArgs e)
        {
            if (suspendUpdate)
            {
                return;
            }

            MainForm.Penny17mRxOC = checkBoxesPenOC17mRX.Value;
        }

        private void checkBoxesPenOC20mRX_CheckedChanged(object sender, EventArgs e)
        {
            if (suspendUpdate)
            {
                return;
            }

            MainForm.Penny20mRxOC = checkBoxesPenOC20mRX.Value;
        }

        private void checkBoxPenOC30mRX_CheckedChanged(object sender, EventArgs e)
        {
            if (suspendUpdate)
            {
                return;
            }

            MainForm.Penny30mRxOC = checkBoxesPenOC30mRX.Value;
        }

        private void checkBoxesPenOC40mRX_CheckedChanged(object sender, EventArgs e)
        {
            if (suspendUpdate)
            {
                return;
            }

            MainForm.Penny40mRxOC = checkBoxesPenOC40mRX.Value;
        }

        private void checkBoxesPenOC60mRX_CheckedChanged(object sender, EventArgs e)
        {
            if (suspendUpdate)
            {
                return;
            }

            MainForm.Penny60mRxOC = checkBoxesPenOC60mRX.Value;
        }

        private void checkBoxesPenOC80mRX_CheckedChanged(object sender, EventArgs e)
        {
            if (suspendUpdate)
            {
                return;
            }

            MainForm.Penny80mRxOC = checkBoxesPenOC80mRX.Value;
        }

        private void checkBoxesPenOC160mRX_CheckedChanged(object sender, EventArgs e)
        {
            if (suspendUpdate)
            {
                return;
            }

            MainForm.Penny160mRxOC = checkBoxesPenOC160mRX.Value;
        }

        // Penny Transmit Open Collector settings

        private void checkBoxesPenOC6mTX_CheckedChanged(object sender, EventArgs e)
        {
            if (suspendUpdate)
            {
                return;
            }

            MainForm.Penny6mTxOC = checkBoxesPenOC6mTX.Value;
        }

        private void checkBoxesPenOC10mTX_CheckedChanged(object sender, EventArgs e)
        {
            if (suspendUpdate)
            {
                return;
            }

            MainForm.Penny10mTxOC = checkBoxesPenOC10mTX.Value;
        }

        private void checkBoxesPenOC12mTX_CheckedChanged(object sender, EventArgs e)
        {
            if (suspendUpdate)
            {
                return;
            }

            MainForm.Penny12mTxOC = checkBoxesPenOC12mTX.Value;
        }

        private void checkBoxesPenOC15mTX_CheckedChanged(object sender, EventArgs e)
        {
            if (suspendUpdate)
            {
                return;
            }

            MainForm.Penny15mTxOC = checkBoxesPenOC15mTX.Value;
        }

        private void checkBoxesPenOC17mTX_CheckedChanged(object sender, EventArgs e)
        {
            if (suspendUpdate)
            {
                return;
            }

            MainForm.Penny17mTxOC = checkBoxesPenOC17mTX.Value;
        }

        private void checkBoxesPenOC20mTX_CheckedChanged(object sender, EventArgs e)
        {
            if (suspendUpdate)
            {
                return;
            }

            MainForm.Penny20mTxOC = checkBoxesPenOC20mTX.Value;
        }

        private void checkBoxesPenOC30mTX_CheckedChanged(object sender, EventArgs e)
        {
            if (suspendUpdate)
            {
                return;
            }

            MainForm.Penny30mTxOC = checkBoxesPenOC30mTX.Value;
        }

        private void checkBoxesPenOC40mTX_CheckedChanged(object sender, EventArgs e)
        {
            if (suspendUpdate)
            {
                return;
            }

            MainForm.Penny40mTxOC = checkBoxesPenOC40mTX.Value;
        }

        private void checkBoxesPenOC60mTX_CheckedChanged(object sender, EventArgs e)
        {
            if (suspendUpdate)
            {
                return;
            }

            MainForm.Penny60mTxOC = checkBoxesPenOC60mTX.Value;
        }

        private void checkBoxesPenOC80mTX_CheckedChanged(object sender, EventArgs e)
        {
            if (suspendUpdate)
            {
                return;
            }

            MainForm.Penny80mTxOC = checkBoxesPenOC80mTX.Value;
        }

        private void checkBoxesPenOC160mTX_CheckedChanged(object sender, EventArgs e)
        {
            if (suspendUpdate)
            {
                return;
            }

            MainForm.Penny160mTxOC = checkBoxesPenOC160mTX.Value;
        }

        private void chkOnlyTxOnPTT_CheckedChanged(object sender, EventArgs e)
        {
            if (suspendUpdate)
            {
                return;
            }

            MainForm.OnlyTxOnPTT = chkOnlyTxOnPTT.Checked;
        }
    }
}
